package yag.battle.model;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import yag.battle.pet.model.Pet;

import java.util.List;

/**
 * Created by user on 25.08.2014.
 */
@Component
@Scope("prototype")
public class Army {
    private int id;
    private List<SwordMan> swordMans;
    private List<Horseman> horsemans;
    private Pet pet;

    public Army() {
    }

    public int getHealth() {

        int countSword = swordMans.size();
        int countHorse = horsemans.size();
        int result;
        if (pet != null) {
            result = countHorse * 100 + countSword * 50 + pet.getMood();
        } else {
            result = countHorse * 100 + countSword * 50;
        }
        return result;

    }

    public int getDamage() {

        int countSword = swordMans.size();
        int countHorse = horsemans.size();
        return countHorse * 25 + countSword * 10;

    }

    public Pet getPet() {
        return pet;
    }

    public void setPet(Pet pet) {
        this.pet = pet;
    }

    public Army(List<SwordMan> swordMans, List<Horseman> horsemans) {
        this.swordMans = swordMans;
        this.horsemans = horsemans;
    }

    public List<SwordMan> getSwordMans() {
        return swordMans;
    }

    public void setSwordMans(List<SwordMan> swordMans) {
        this.swordMans = swordMans;
    }

    public List<Horseman> getHorsemans() {
        return horsemans;
    }

    public void setHorsemans(List<Horseman> horsemans) {
        this.horsemans = horsemans;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "Army{" +
                "id=" + id +
                ", swordMans=" + swordMans +
                ", horsemans=" + horsemans +
                ", pet=" + pet +
                '}';
    }
}
